-
Notifications
You must be signed in to change notification settings - Fork 288
feat: claude citation support with BedrockModel #631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: claude citation support with BedrockModel #631
Conversation
@@ -24,10 +24,11 @@ | |||
from mcp.types import ImageContent as MCPImageContent | |||
from mcp.types import TextContent as MCPTextContent | |||
|
|||
from strands.types.tools import ToolResultContent, ToolResultStatus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why relative to absolute import?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mypy was complaining without it
if "citationsContent" not in state: | ||
state["citationsContent"] = [] | ||
|
||
state["citationsContent"].append(delta_content["citation"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of just appending the response to a list, I can see that the CitationSourceContentDelta
event mentions that it contains "incremental updates to the source content text during streaming responses". Does this mean we are concatenating the strings of the CitationSourceContentDelta events, or just appending the events to an array?
@@ -206,6 +214,18 @@ def handle_content_block_stop(state: dict[str, Any]) -> dict[str, Any]: | |||
) | |||
state["reasoningText"] = "" | |||
|
|||
# Handle citations_content independently - not as elif since we can have both text and citations | |||
if citations_content: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be made into an elif?
Co-authored-by: Nick Clegg <[email protected]>
Description
Adds support for citations when using Anthropic Claude Sonnet 3.5v2 and above
Related Issues
#570
Documentation PR
Type of Change
New feature
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
hatch run prepare
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.